T = [73, 74, 75, 71, 69, 72, 76, 73]

res = [0] * len(T)

index = []
for i in range(len(T)):
    if len(index) == 0:
        index.append(i)
    else:
        if T[i] > T[index[len(index) - 1]]:
            while len(index) != 0 and T[i] > T[index[len(index) - 1]]:
                res[index[len(index) - 1]] = i - index[len(index) - 1]
                index.pop()
            index.append(i)
        else:
            index.append(i)

print(res)
